package com.example.Dao;

import com.example.entity.Adminusers;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface AdminuserMapper {

    @Select("select * from adminusers where aduName = #{adminusers.aduname} AND aduPwd = #{adminusers.adupwd}")
    public Adminusers geAdminUser(@Param("adminusers") Adminusers adminusers);

    @Select("select * from adminusers")
    ArrayList<Adminusers> queryAll();

    @Delete("delete from adminusers where aduID = #{aduID}")
    int deleteByID(Integer uID);

    @Select("select * from adminusers where aduID = #{aduID}")
    Adminusers findById(Integer uID);

//    @Update("UPDATE adminusers SET"+
//            "aduName = #{adminusers.aduname}," +
//            "aduPwd = #{adminusers.adupwd}," +
//            "WHERE aduID =  #{adminusers.aduid}")
    @Update("UPDATE adminusers SET "+
             "aduName = #{adminusers.aduname},"+
             "aduPwd = #{adminusers.adupwd}"+
              "WHERE aduID = #{adminusers.aduid}")
    int update(@Param("adminusers") Adminusers adminusers);

    @Insert("INSERT INTO adminusers(aduName,aduPwd)" +
            "VALUES" +
            "(#{adminusers.aduname},#{adminusers.adupwd})")
    int insert(@Param("adminusers") Adminusers adminusers);


}
